package xj.model.uml;

import java.util.HashSet;
import java.util.Set;

public class DataTypes {

  public static Set<String> primitiveTypes;

  public static Set<String> predefinedTypes;

  public static boolean isPrimitiveType(String type) {
    return primitiveTypes.contains(type);
  }

  public static boolean isPredefinedType(String type) {
    return predefinedTypes.contains(type);
  }

  private static String[] primitiveTypeNames = { 
    "String", 
    "boolean",
    "Boolean", 
    "char", 
    "Character", 
    "byte", 
    "Byte", 
    "int", 
    "Integer", 
    "long",
    "Long", 
    "short", 
    "Short", 
    "double", 
    "Double", 
    "float", 
    "Float",
    "Decimal",
  };

  private static String[] predefinedTypeNames = { 
    "Object", 
    "Date", 
    "Time",
    "DateTime", 
    "Timestamp", 
    "Collection", 
    "List", 
    "Set", 
    "Map", 
    "Document",
    "URI", 
    "URL", 
    "File", 
    "Money", 
    "Blob", 
    "Clob",
  };

  static {
    primitiveTypes = new HashSet<String>();
    for (int i = 0; i < primitiveTypeNames.length; i++) {
      primitiveTypes.add(primitiveTypeNames[i]);
    }
    predefinedTypes = new HashSet<String>();
    for (int i = 0; i < predefinedTypeNames.length; i++) {
      predefinedTypes.add(predefinedTypeNames[i]);
    }

  }

}
